﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Web;

namespace AgileNYCWebService.Manager.Data.Table
{
	public class BaseClass
	{
		public BaseClass()
			: this(null)
		{

		}

		public BaseClass(DataRow row)
		{
			if (row != null)
			{
				if (row.Table.Columns.Contains("Id"))
					Id = row["Id"].GetInteger(-1);
                if (row.Table.Columns.Contains("ModifiedDate") && row["ModifiedDate"] != null && !row["ModifiedDate"].Equals(DBNull.Value) && !String.IsNullOrEmpty(row["ModifiedDate"].ToString()))
                    ModifiedDate = (DateTime?)row["ModifiedDate"];
                else
                    ModifiedDate = null;

                if (row.Table.Columns.Contains("Note") && row["Note"] != null && !row["Note"].Equals(DBNull.Value) && !String.IsNullOrEmpty(row["Note"].ToString()))
                    Note = row["Note"].GetString(string.Empty);
                else
                    Note = string.Empty;

				if (row.Table.Columns.Contains("IsDelete"))
					IsDelete = row["IsDelete"].GetBoolean(false);
			}
		}

		public int Id { get; set; }
		public DateTime? ModifiedDate { get; set; }
		public string Note { get; set; }
		public bool IsDelete { get; set; }
	}
}